import request from "@/utils/request";
import { requestPath } from "@/utils/global.js";

export function ebookDetails(params) { //图书阅读页
  return request({
    url: `${requestPath.resource}/article-library/get`,
    method: "get",
    params
  });
}

export function getRelation(params) {
  //文章推荐
  return request({
    url: `${requestPath.resource}/article-library/relation-resource/get`,
    method: "get",
    params
  });
}

export function getResourceListAPI() {
  //资源列表--文章...
  return request({
    // url: `${requestPath.resource}/resource/article-library/Type/list`,
    url: `${requestPath.resource}/resource/app/search`,
    method: "get"
  });
}

export function getListCount(params) {
  //资源数量列表
  return request({
    url: `${requestPath.resource}/resource/Type/count`,
    method: "get",
    params
  });
}

export function getList(params) {
  //资源列表
  return request({
    url: `${requestPath.resource}/resource/app/search`,
    // url: `${requestPath.resource}/resource/diytype/name/tree`,
    method: "get",
    params
  });
}

export function getAudioAPI(params) {
  //获音频地址
  return request({
    url: `file1/file/getFilePath?fileName=${params}`,
    method: "get"
  });
}
// 筛选一级列表
export function getListTree(params) {
  return request({
    url: `${requestPath.resource}/diytype/name/tree`,
    method: "get",
    params
  });
}
// 筛选二级列表
// export function getListTreeBranch(params) {
//   return request({
//     url: `${requestPath.resource}/diytype/secondLevel/list`,
//     method: "get",
//     params
//   });
// }
export function getListTreeBranch(params) {
  return request({
    url: `${requestPath.resource}/diytype/get/childLevel/list`,
    method: "get",
    params
  });
}

// 图书详情
export function getBookDetails(params) {
  return request({
    url: `${requestPath.resource}/ebook/get/${params}`,
    method: "get",
    params
  });
}

// 目录
export function getBookCatalogue(params) {
  return request({
    url: `${requestPath.resource}/ebook/directory`,
    method: "get",
    params
  });
}
// 推荐
export function getBookRecommend(params) {
  return request({
    url: `${requestPath.resource}/ebook/related/books`,
    method: "get",
    params
  });
}

export function catalogList(params) { //目录
  return request({
    url: `${requestPath.resource}/article-library/directory`,
    method: 'get',
    params
  })
}
